package lights;

import java.awt.Color;
import java.util.ArrayList;
import java.util.List;

/*
 * Author : rendyjr
 * Date   : Jun 11, 2011
 * 6.005 Elements of Software Construction
 * Rendy Bambang Junior
 * rendy.jr@gmail.com
 * 
 * MyHolidayLight implements HolidayLights and represent custom light style.
 * It contains blinking colorful light
 * 
 */

public class MyHolidayLight implements HolidayLights {

	// list contains lights 
	private List<Light> lights;
	
	// My Holiday Light
	public MyHolidayLight(int length){
		lights = new ArrayList<Light>();
		for(int i=0; i<length; i++){
			lights.add(new ColoredLight(Color.red));
			lights.get(i).randomChange();
			lights.get(i).setOn(false);
		}
	}
	
	@Override
	public List<Light> next() {
		// TODO Auto-generated method stub
		for(Light l:lights)
			l.setOn(!l.isOn());
		return lights;
	}

	@Override
	public int getLength() {
		// TODO Auto-generated method stub
		return lights.size();
	}

}
